package cn.maihe.elg.operation.utils;

import org.slf4j.Logger;

import java.util.function.Consumer;

/**
 * @Description
 * @Author WJH
 * @Date 2021/04/19
 */
public class ElgLogger {

    public static void debug(Logger log, Consumer<Logger> consumer) {
        if (log.isDebugEnabled()) {
            consumer.accept(log);
        }
    }

    public static void info(Logger log, Consumer<Logger> consumer) {
        if (log.isInfoEnabled()) {
            consumer.accept(log);
        }
    }

    public static void warn(Logger log, Consumer<Logger> consumer) {
        if (log.isWarnEnabled()) {
            consumer.accept(log);
        }
    }

    public static void error(Logger log, Consumer<Logger> consumer) {
        if (log.isErrorEnabled()) {
            consumer.accept(log);
        }
    }

}
